extends Control


func _on_出大_pressed():
	ObjectManager.soundManager.play(SoundType.button_click)
	var big = ObjectManager.gameManager.operationManager.selectedPoint.big as Big
	if (big.arr_states.has(BigStateType.ICE)):
		ObjectManager.toast.showToast("冰冻状态无法行动")
		return
	var cost = SpendData.COST_BORN_BIG
	if big.arr_states.has(BigStateType.FERTILE):
		cost -= 1
	if big.arr_states.has(BigStateType.BURDEN):
		cost += 1
	if !GameUtils.checkIsReadyAction() || !GameUtils.checkActionEnough(cost):
		return
	ObjectManager.gameManager.operationManager.changeOperationType(OperationType.big_born_big)
	visible = false
	ObjectManager.gameManager.ui.closeDesc()

# 大子移动
func _on_移动_pressed():
	ObjectManager.soundManager.play(SoundType.button_click)
	var big = ObjectManager.gameManager.operationManager.selectedPoint.big as Big
	if (big.arr_states.has(BigStateType.ICE)):
		ObjectManager.toast.showToast("冰冻状态无法行动")
		return
	var cost = SpendData.COST_BIG_MOVE
	if big.arr_states.has(BigStateType.BURDEN):
		cost += 1
	if !GameUtils.checkIsReadyAction() || !GameUtils.checkActionEnough(cost):
		return
	ObjectManager.gameManager.operationManager.changeOperationType(OperationType.big_move)
	visible = false
	ObjectManager.gameManager.ui.closeDesc()

# 大子攻击
func _on_攻击_pressed():
	ObjectManager.soundManager.play(SoundType.button_click)
	var selectedPoint = ObjectManager.gameManager.operationManager.selectedPoint as Point
	if (selectedPoint.hasOthersMark("佛法慈悲")):
		ObjectManager.toast.showToast("佛法慈悲，不能攻击")
		return
	var big = selectedPoint.big
	if (big.arr_states.has(BigStateType.ICE)):
		ObjectManager.toast.showToast("冰冻状态无法行动")
		return
	var cost = SpendData.COST_BIG_ATTACK
	if selectedPoint.hasMyMark("地狱杀伐"):
		cost -= 2
	if big.arr_states.has(BigStateType.BURDEN):
		cost += 1
	if !GameUtils.checkIsReadyAction() || !GameUtils.checkActionEnough(cost):
		return
	if big.arr_states.has(BigStateType.FEAR):
		ObjectManager.toast.showToast("怯战，不能攻击")
		return
	ObjectManager.gameManager.operationManager.changeOperationType(OperationType.big_attack)
	visible = false
	ObjectManager.gameManager.ui.closeDesc()

# 大子转型
func _on_转型_pressed():
	ObjectManager.soundManager.play(SoundType.button_click)
	var selectedPoint = ObjectManager.gameManager.operationManager.selectedPoint as Point
	var big = selectedPoint.big
	if (big.arr_states.has(BigStateType.ICE)):
		ObjectManager.toast.showToast("冰冻状态无法行动")
		return
	$"../转型弹框".showDialog()


func _on_出大_mouse_entered():
	var ui = ObjectManager.gameManager.ui as UI
	ui.wantShowDesc("出大：消耗2点能量，从我身上出一个大子")


func _on_移动_mouse_entered():
	var ui = ObjectManager.gameManager.ui as UI
	ui.wantShowDesc("移动：消耗1点能量，移动到周围指定落点")


func _on_攻击_mouse_entered():
	var ui = ObjectManager.gameManager.ui as UI
	ui.wantShowDesc("攻击：消耗2点能量，移动到周围指定落点，并攻击敌方大子")


func _on_转型_mouse_entered():
	var ui = ObjectManager.gameManager.ui as UI
	ui.wantShowDesc("转型：消耗科技点，放弃出大能力，转型成特殊大子")


func _on_mouse_exited():
	var ui = ObjectManager.gameManager.ui as UI
	ui.closeDesc()
